<template>
	<view style="padding-top: 20upx;">
		<view class="webkit list">
			<view class="title">姓名</view>
			<input type="text" @input="nameInput" class="flex" v-model="name" placeholder="请输入姓名" />
		</view>
		<view class="webkit list">
			<view class="title">身份证号</view>
			<input type="text" @input="idcardInput" class="flex" v-model="idcard" placeholder="请输入身份证号" />
		</view>
		
		<view style="padding: 0 24upx;">
			<button type="primary" style="background-color: #05052B; margin-top: 20upx;" @click="submit" :loading="loading">确认提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				idcard:'',
				name:'',
				loading: false,
				openid:''
			};
		},
		onLoad:function(){
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
				},
				fail: () => {
					uni.navigateTo({
						url: '../../login/login'
					});
				}
			});
		},
		methods:{
			nameInput(e) {
				this.name = e.target.value
			},
			idcardInput(e) {
				this.idcard = e.target.value
			},
			submit(){
				if (this.name == "") {
					uni.showToast({
						title: '请输入姓名',
						icon: "none"
					});
				} else if (this.idcard == "") {
					uni.showToast({
						title: '请输入身份证号',
						icon: "none"
					});
				} else {
					uni.request({
						url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=member.real_name_verfy&app=1',
						method: 'POST',
						data: {
							realname: this.name,
							idcard: this.idcard,
							openid: this.openid
						},
						header: {
							'Content-Type': 'application/x-www-form-urlencoded'
						},
						success: res => {
							console.log(res)
							uni.showToast({
								title: res.data.message,
								icon: "none"
							});
						},
						fail: () => {},
						complete: () => {}
					});
				}
			}
			
		}
	}
</script>

<style>.list{padding:16upx 24upx;background:#fff;position:relative;}.list:last-child:after{display:none;}.list:after{content:" ";position:absolute;left:20upx;right:20upx;bottom:-2upx;height:2upx;border-top:2upx solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);}.list .title{width:150upx;line-height:50upx;color:#666;}.list .flex{line-height:50upx;color:#666;padding-left:24upx;}.inputright{width:200upx;height:52upx;}button.inputright{line-height:48upx;font-size:24upx;background:transparent;border:2upx solid #333;}</style>
